#include "dieselgenerator.h"
#include <QIcon>
#include <QDebug>

DieselGenerator::DieselGenerator(const QString& name, double maxPower, double minPower, double efficiency, QObject* parent)
    : Component(name, parent),
    m_maxPower(maxPower),
    m_minPower(minPower),
    m_efficiency(efficiency)
{
    m_icon = QIcon(":/icons/diesel.png");
}

void DieselGenerator::update(int timeStep, double dt) {
    Q_UNUSED(timeStep);
    Q_UNUSED(dt);
    // 简化模型：按最大功率的70%运行
    m_power = m_maxPower * 0.7;
}

void DieselGenerator::modifyParameters() {
    // 实际应用中会弹出对话框，这里简化为控制台输出
    qDebug() << "修改柴油发电机参数:" << getName();
}

double DieselGenerator::getMaxPower() const {
    return m_maxPower;
}

double DieselGenerator::getMinPower() const {
    return m_minPower;
}

double DieselGenerator::getEfficiency() const {
    return m_efficiency;
}
